package com.mc.book.controller;

import com.mc.book.enums.ResponseEnum;
import com.mc.book.pojo.Result;
import com.mc.book.pojo.request.RequestBookContent;
import com.mc.book.pojo.request.RequestFeedBack;
import com.mc.book.pojo.request.RequestUser;
import com.mc.book.service.CommonService;
import com.mc.book.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "公共模块")
@RestController
public class CommonApi extends BaseApi{
	private static final Logger log = LoggerFactory.getLogger(CommonApi.class);
	@Autowired
	private CommonService commonService;

	@ApiOperation("首页标题")
	@PostMapping("mc/common/title")
	public Result commonTitle(){
		try {
			return commonService.commonTitle();
		}catch (Exception e){
			log.error("系统异常：", e);
			return Result.fail(ResponseEnum.UP_SYSTEM_FAILURE.getCode(),ResponseEnum.UP_SYSTEM_FAILURE.getMessage());
		}
	}

	@ApiOperation("意见反馈")
	@PostMapping("mc/feedback/add")
	public Result feedbackAdd(@RequestBody RequestFeedBack request){
		try {
			return commonService.feedbackAdd(request);
		}catch (Exception e){
			log.error("系统异常：", e);
			return Result.fail(ResponseEnum.UP_SYSTEM_FAILURE.getCode(),ResponseEnum.UP_SYSTEM_FAILURE.getMessage());
		}
	}


}
